package com.lucky.common.mapper;

import com.lucky.common.pojo.po.PermPO;
import com.lucky.common.pojo.vo.PermVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PermMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<PermPO> {
	
	@Select("SELECT * from m_user_right t  WHERE t.right_code = #{right_code}")
	PermVO getPermByCode(@Param("right_code") String right_code);

	@Select("select * from m_user_right r where r.url = #{uri}")
	PermVO getPermByUrl(@Param("uri") String uri);
	
	@Select("SELECT * from m_user_right t  WHERE t.sup_right_code = #{superCode} order by t.id")
	List<PermVO> queryChild(@Param("superCode") String superCode);

	List<String> queryPermUrlByRole(String roleCode);
	List<PermVO> queryPermByRole(String roleCode);
	List<String> queryAllPermUrl();

	List<PermVO> queryPerm(@Param("superCode") String superCode);

}